import request from '@/utils/request'

export default class CommonApi {
  constructor(prefixurl) {
    this.prefixurl = prefixurl
  }
  exportUrl() {
    return this.prefixurl + '/doExport'
  }
  gridExportUrl() {
    return this.prefixurl + '/doGridCommonExport'
  }
  importUrl() {
    return this.prefixurl + '/doImport'
  }
  manualProcessOtherStateUrl() {
    return this.prefixurl + '/doManualProcessOtherState'
  }
  destoryUrl() {
    return this.prefixurl + '/doDestory'
  }
  importTemplateUrl() {
    return this.prefixurl + '/downloadImportTemplate'
  }
  loadOtherDataUrl() {
    return this.prefixurl + '/loadOtherData'
  }
  loadDataUrl() {
    return this.prefixurl + '/loadData'
  }
  loadHistoryDataUrl() {
    return this.prefixurl + '/loadHistoryData'
  }
  deleteUrl() {
    return this.prefixurl + '/doDelete'
  }
  printUrl() {
    return this.prefixurl + '/doPrint'
  }
  batchPrintUrl() {
    return this.prefixurl + '/doBatchPrint'
  }
  submitUrl() {
    return this.prefixurl + '/doSubmit'
  }
  postRequestByName(name, data) {
    return request({
      url: this.prefixurl + '/' + name,
      method: 'post',
      data
    })
  }
  getRequestByName(name, data) {
    return request({
      url: this.prefixurl + '/' + name,
      method: 'get',
      params: data
    })
  }
  toAdd(data) {
    return request({
      url: this.prefixurl + '/toAdd',
      method: 'post',
      data
    })
  }

  toCopy(data) {
    return request({
      url: this.prefixurl + '/toCopy',
      method: 'post',
      data
    })
  }
  toChange(data) {
    return request({
      url: this.prefixurl + '/toChange',
      method: 'post',
      data
    })
  }
  viewMainData(data) {
    return request({
      url: this.prefixurl + '/toView',
      method: 'post',
      data
    })
  }
  toViewApprove(data) {
    return request({
      url: this.prefixurl + '/toViewApprove',
      method: 'post',
      data
    })
  }
  addOrEdit(data) {
    return request({
      url: this.prefixurl + '/doSave',
      method: 'post',
      data
    })
  }

  del(data) {
    return request({
      url: this.prefixurl + '/doDelete',
      method: 'post',
      data
    })
  }
}
